<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="iconfont/iconfont.css">
    <link rel="stylesheet" href="css/login.css">
    <script src="iconfont/iconfont.js"></script>
    <title>用户登录</title>
</head>

<body>
    <div class="wrapper">
        <div class="loginBox">
            <h2>用户登录</h2>
            <div>
                <span class="iconfont">&#xe651;</span>
                <input type="text" name="username" placeholder="请输入用户名">
            </div>
            <div>
                <span class="iconfont">&#xe797;</span>
                <input type="password" name="psw" placeholder="请输入密码" id="psw">
                <span class="eye eye1 iconfont" onclick="isLook()">&#xe61d;</span>
                <span class="eye eye2 iconfont" onclick="isLook()">&#xe7ad;</span>
            </div>
            <button onclick="login()">登录</button>
        </div>
    </div>
</body>
<script>
    function login() {
        location.replace('site.html')
    }
    var eye1 = document.getElementsByClassName('eye1')[0];
    var eye2 = document.getElementsByClassName('eye2')[0];
    eye2.setAttribute("style", "display:none")

    function isLook() {
        var input = document.getElementById('psw');
        if (input.type == "text") {
            input.setAttribute("type", "password");
            eye1.setAttribute("style", "display:block");
            eye2.setAttribute("style", "display:none");
        } else {
            input.setAttribute("type", "text");
            eye2.setAttribute("style", "display:block");
            eye1.setAttribute("style", "display:none");
        }
    }
</script>

</html>